package de.openkanban.shared.dto;

import java.util.HashMap;
import java.util.Map;

import de.openkanban.client.ui.presenter.RequestParameterMap;
import de.openkanban.client.util.JsonConverter;

/**
 * Data Transfer Object used for transferring Board information
 */
public class BoardDto extends TransferObject implements RequestParameterMap {

	private Long boardId;

	private String boardName;

	public BoardDto() {
	}

	public BoardDto(String json) {
		boardId = JsonConverter.getLongValueOrNull(json, "boardId");
		boardName = JsonConverter.getStringValueOrNull(json, "boardName");
	}

	public Long getBoardId() {
		return boardId;
	}

	public void setBoardId(Long boardId) {
		this.boardId = boardId;
	}

	public String getBoardName() {
		return boardName;
	}

	public void setBoardName(String boardName) {
		this.boardName = boardName;
	}

	@Override
	public Map<String, String> valuesToMap() {
		Map<String, String> requestParameterMap = new HashMap<String, String>();
		if (boardId != null) {
			requestParameterMap.put("boardId", Long.toString(boardId));
		}
		requestParameterMap.put("boardName", boardName);
		return requestParameterMap;
	}

}
